package light.network;

import java.io.IOException;
import java.net.SocketAddress;
import java.nio.ByteBuffer;

public interface Endpoint {

	void setReceiveHandler(IEndpointHandler handler);

	void bind(SocketAddress address) throws IOException;

	void start(SocketAddress address) throws IOException;

	void stop();

	int getBufferSize();

	void setBufferSize(int bufferSize);

	void close() throws IOException;

	SocketAddress getLocalAddress() throws IOException;

	void openSession(SocketAddress target, Object attachment, SendHandler handler);
	
	Packet allocatePacket(int capacity);
	Packet wrapPacket(ByteBuffer src);
}
